#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct block{
    int xl,xr,yl,yr,del=0;
    block(){}
    block(int x,int y){
        xl=xr=x,yl=yr=y,del=0;
    }
    void operator+=(block &o){
        o.del=1;
        xl=min(xl,o.xl);
        xr=max(xr,o.xr);
        yl=min(yl,o.yl);
        yr=max(yr,o.yr);
    }
}b[1005];
bool it(int l1,int r1,int l2,int r2){
    return max(l1,l2)<=min(r1,r2);
}
queue<int>qx,qy;
int c[1005][1005];
bool check(int x,int y){
    return c[x][y]==0 && c[x-1][y]+c[x+1][y]+c[x][y-1]+c[x][y+1]>=2;
}
int dx[4]={-1,1,0,0};
int dy[4]={0,0,-1,1};
int main(){
    freopen("grid.in","r",stdin);
    freopen("grid.out","w",stdout);
    int n,m,B;
    scanf("%d%d%d",&n,&m,&B);
    for(int i=1;i<=B;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        b[i]=block(x,y);
        c[x][y]=1;
    }
    if(B<=1000){
        for(int i=1;i<=B;i++)if(!b[i].del){
            // printf("i=%d\n",i);
            int fl;
            do{
                fl=0;
                for(int j=1;j<=B;j++)if(i!=j && !b[j].del){
                    if((it(b[i].xl,b[i].xr,b[j].xl,b[j].xr) && it(b[i].yl-2,b[i].yr+2,b[j].yl,b[j].yr)) || (it(b[i].xl-2,b[i].xr+2,b[j].xl,b[j].xr) && it(b[i].yl,b[i].yr,b[j].yl,b[j].yr)) || (it(b[i].xl-1,b[i].xr+1,b[j].xl,b[j].xr) && it(b[i].yl-1,b[i].yr+1,b[j].yl,b[j].yr))){
                        fl=1;
                        b[i]+=b[j];
                    }
                }
            }
            while(fl);
        }
        ll ans=0;
        for(int i=1;i<=B;i++)if(!b[i].del)ans+=(ll)(b[i].xr-b[i].xl+1)*(b[i].yr-b[i].yl+1);
        printf("%lld",ans);
    }
    else{
        for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)if(check(i,j)){
            qx.push(i);
            qy.push(j);
        }
        while(!qx.empty()){
            int fx=qx.front(),fy=qy.front();
            qx.pop();
            qy.pop();
            if(c[fx][fy])continue;
            c[fx][fy]=1;
            for(int d=0;d<4;d++){
                int nx=fx+dx[d],ny=fy+dy[d];
                if(check(nx,ny)){
                    qx.push(nx);
                    qy.push(ny);
                }
            }
        }
        int ans=0;
        for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)ans+=c[i][j];
        printf("%d",ans);
    }
    return 0;
}